package com.si2.gui.view;

import jason.environment.grid.GridWorldView;

import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics;

import com.si2.gui.model.AspiradorModel;

public class AspiradorView extends GridWorldView {

	private static final long serialVersionUID = 1L;
	private AspiradorModel model;

	public AspiradorView(AspiradorModel model) {
		super(model, AspiradorModel.TITLE, AspiradorModel.WINDOW_SIZE);
		this.model = model;
        defaultFont = new Font("Arial", Font.BOLD, 14);
        setVisible(true);
        repaint();
	}
	
	 public void draw(Graphics g, int x, int y, int object) {
         switch (object) {
             case AspiradorModel.LIXO: 
            	 drawGarb(g, x, y);  
            	 break;
         }
     }
		
     @Override
     public void drawAgent(Graphics g, int x, int y, Color c, int id) {
         String label = "ASP"; // +(id+1);
         
         if (id == 0) {
             c = Color.yellow;
				label += " - L"+model.getTotalAspirado();        
         }
         super.drawAgent(g, x, y, c, -1);
         if (id == 0) {
             g.setColor(Color.black);
         } else {
             g.setColor(Color.white);                
         }
         super.drawString(g, x, y, defaultFont, label);
     }
		
     public void drawGarb(Graphics g, int x, int y) {
         super.drawObstacle(g, x, y);
         g.setColor(Color.white);
         drawString(g, x, y, defaultFont, "G");
     }

}
